package p2p.peer.client;

public class Client {

	private String ip;
	private int port;

	public int getPort() {
		return port;
	}

	public Client(String ip, int port) {
		this.ip = ip;
		this.port = port;
	}

	public Client(byte[] arr) {
		this.ip = "";
		for (byte i : arr) {
			this.ip += String.valueOf(i) + ".";
		}
		this.ip = this.ip.substring(0, this.ip.length() - 1);
	}
	
	public String getIp() {
		return ip;
	}


	@Override
	public int hashCode() {
		return this.ip.hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Client){
			Client tmp = (Client) obj;
			if (tmp.ip.equals(this.ip))
				return true;
			else
				return false;
		}
		return false;
	}

}